package entities;

import entities.BasicProduct;
import dto.ExcursionDTO;


import java.io.Serializable;
import java.lang.String;
import java.util.Date;

import javax.persistence.*;

/**
 * Entity implementation class for Entity: ExcursionEntity
 *
 */
@Entity
@Table(name="EXCURSIONS")
@NamedQueries({
	@NamedQuery(name=ExcursionEntity.FIND_ALL,
				query="SELECT e FROM ExcursionEntity e ORDER BY e.insertedOn ASC"),
	@NamedQuery(name=ExcursionEntity.FIND_FOR_USER,
				query="SELECT e FROM ExcursionEntity e WHERE e.available=1 AND e.disponibility > 0")
})

public class ExcursionEntity extends BasicProduct implements Serializable {
	private static final long serialVersionUID = 1L;
	
	public static final String FIND_ALL = "ExcursionEntity.findAll";
	public static final String FIND_FOR_USER = "ExcursionEntity.findForUser";
	
	
	private String description;
	private String type;
	@Temporal(javax.persistence.TemporalType.DATE)
	private Date date;
	@Temporal(javax.persistence.TemporalType.DATE)
	private Date startTime;
	@Temporal(javax.persistence.TemporalType.DATE)
	private Date endTime;
	

	public ExcursionEntity() {
		super();
	}   
	
	
	public ExcursionEntity(ExcursionDTO excursion) 
	{
		super(excursion.getId(),excursion.isAvailable(), excursion.getDisponibility(), excursion.getPrice(), excursion.getAdmin());
		this.description = excursion.getDescription();
		this.type=excursion.getType();
		this.date=excursion.getDate();
		this.startTime=excursion.getStartTime();
		this.endTime=excursion.getEndTime();
		
	} 
	
	public String getDescription() 
	{
		return description;
	}
	
	public void setDescription(String description) {
		this.description = description;
	}

	
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}   
	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}   
	public Date getStartTime() {
		return this.startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}   
	public Date getEndTime() {
		return this.endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@Override
	public String toString() {
		return "ExcursionEntity [description=" + description + ", type=" + type
				+ ", date=" + date + ", start_time=" + startTime
				+ ", end_time=" + endTime + "]";
	}
   
	
	
}
